
             
/**
 * Copyright (c) 2012-2013 JLLT Corp. 2012-2013,All Rights Reserved.
 * This software is published under the 金麟龙腾商贸有限公司.
 * License version 1.0, a copy of which has been included with this
 * distribution in the LICENSE.txt file.
 *
 * @File name:  AddTDeliveryAddressAction.java   添加【会员收货地址信息:T_DELIVERY_ADDRESS】
 * @Create on:  2012-10-09 11:34:613
 * @Author   :  陈伟
 *
 * @ChangeList
 * ---------------------------------------------------
 * Date         Editor              ChangeReasons
 *
 */
           
        
package com.boho.ecp.member.action;

            
import java.sql.Connection;

import cn.boho.framework.actions.ActionImp;
import cn.boho.framework.context.ActionContext;
import cn.boho.framework.exception.UserOperationException;
import cn.boho.framework.po.POUtils;
import cn.boho.framework.service.MessageService;
import cn.boho.framework.utils.HTMLFilter;

import com.boho.ecp.constant.Member;
import com.boho.ecp.po.TDeliveryAddressPO;

public class AddTDeliveryAddressAction extends ActionImp {
	private TDeliveryAddressPO tDeliveryAddressPO = new TDeliveryAddressPO();
	private Connection con=null;
	@Override
	protected void doException(ActionContext atx, Exception ex) {
		if (!(ex instanceof UserOperationException)) {
			atx.setErrorContext("BOHO_COMMON_1001", MessageService.getMessage("BOHO_COMMON_1001"),"【会员收货地址信息】", ex);
		}
	}
	@Override
	protected int performExecute(ActionContext atx) throws Exception {
		POUtils.insert(con, tDeliveryAddressPO,false);
		return 1;
	}
	@Override
	protected int verifyParameters(ActionContext atx) throws Exception {
		con = atx.getConection();
		Integer createBy = (Integer)atx.getSessionValue(Member.MEMBER_ID_SESSION);
		tDeliveryAddressPO.setMemberId(createBy);
		tDeliveryAddressPO.setConsigneeName(HTMLFilter.filter(atx.getStringValue("CONSIGNEE_NAME")));
		tDeliveryAddressPO.setProvince(HTMLFilter.filter(atx.getStringValue("PROVINCE")));
		tDeliveryAddressPO.setCity(HTMLFilter.filter(atx.getStringValue("CITY")));
		tDeliveryAddressPO.setCounty(HTMLFilter.filter(atx.getStringValue("COUNTY")));
		tDeliveryAddressPO.setDeliveryAddress(HTMLFilter.filter(atx.getStringValue("DELIVERY_ADDRESS")));
		tDeliveryAddressPO.setZipCode(HTMLFilter.filter(atx.getStringValue("ZIP_CODE")));
		tDeliveryAddressPO.setMobile(HTMLFilter.filter(atx.getStringValue("MOBILE")));
		tDeliveryAddressPO.setTelephone(HTMLFilter.filter(atx.getStringValue("TELEPHONE")));
		tDeliveryAddressPO.setIsDefault(atx.getIntegerValue("IS_DEFAULT"));
		tDeliveryAddressPO.setCreateBy(createBy.toString());
		tDeliveryAddressPO.setCreateDate(new java.util.Date());
		return 1;
	}
}
